﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LifeTree.DomainModel.Repositories;
using LifeTree.DomainModel.Entities;

namespace LifeTree.Mvc.Tests
{
    public class WorkbookRepositoryFake : IWorkbookRepository
    {
        private List<Workbook> workbooks = new List<Workbook>();

        #region IWorkbookRepository Members

        public Workbook GetByName(string name)
        {
            return workbooks.FirstOrDefault(w => w.Name == name);
        }

        public void Add(Workbook entity)
        {
            workbooks.Add(entity);
        }

        public void Remove(Workbook entity)
        {
            workbooks.Remove(entity);
        }

        public Workbook GetById(string id)
        {
            return workbooks.FirstOrDefault(w => w.Id == id);
        }

        public IEnumerable<Workbook> GetAll()
        {
            return workbooks;
        }

        #endregion
    }
}
